﻿--[[
This file is part of FlexBar3.

FlexBar3 is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

FlexBar3 is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with FlexBar3.  If not, see <http://www.gnu.org/licenses/>.
]]
-- Local upvalues
local FlexBar3 = FlexBar3;

function FlexBar3:Initialize()
	self:InitializeDB();
	if(self.DB.Enabled == true) then
		self:Enable();
	end
end

function FlexBar3:Enable()
	self:Debug("Enabling FlexBar3");
	self.Enabled = true;
	self:EnableModules();
end

function FlexBar3:Disable()
	self:Debug("Disabling FlexBar3");
	self.Enabled = false;
	self:DisableModules();
end

FlexBar3:SetScript("OnEvent", function(self, Event, ...)
	if(Event == "PLAYER_LOGIN") then
		FlexBar3:Initialize();
	end
end);

FlexBar3:RegisterEvent("PLAYER_LOGIN");